import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wwy
 * Date: 2024-11-10
 * Time: 21:07
 */
public class Test12 {
    public static void move(char pos1,char pos2) {
        System.out.println(pos1+"->"+pos2+" ");
    }


    public static void hanoi(int n,char pos1,char pos2,char pos3) {
        if(n == 1) {
            move(pos1,pos3);
            return;
        }
        hanoi(n-1,pos1,pos3,pos2);
        move(pos1,pos3);
        hanoi(n-1,pos2,pos1,pos3);
    }

    public static void main(String[] args){
        int[] arr={9,8,7,4,3,2,1};
        System.out.println(Arrays.toString(arr));
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.binarySearch(arr,7));
    }
    public static int[] func1(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            arr[i]=arr[i]*2;
        }
        return arr;
    }
    public static void bubbleSort(int[] array){
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length - 1 - i; j++) {
                boolean flg=false;
                if(array[j]>array[j+1]){
                    int tmp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=tmp;
                    flg=true;
                }
                if(flg==false){
                    return;
                }
            }
        }
    }
}
